package com.threeonemeeting.list;

import java.util.ArrayList;
import java.util.List;

import com.threeonemeeting.model.MeetingExpress;

public class MeetingExpressList {

	public List<MeetingExpress> listMeetingExpress = new ArrayList<MeetingExpress>();

	public void addMeetingExpress(MeetingExpress info) {
		if (info == null)
			return;

		listMeetingExpress.add(info);
	}

	public void addMeetingExpress(int nId, String strName, String strTitle) {
		MeetingExpress info = new MeetingExpress();
		info.nId = nId;
		info.strName = strName;
		info.strTitle = strTitle;

		listMeetingExpress.add(info);
	}

	public int size() {
		return listMeetingExpress.size();
	}

	public MeetingExpress get(int nLocation) {
		return listMeetingExpress.get(nLocation);
	}

	public void clear() {
		listMeetingExpress.clear();
	}

	public MeetingExpress getMeetingExpress(int nId) {
		for (int i = 0; i < listMeetingExpress.size(); i++) {
			MeetingExpress info = listMeetingExpress.get(i);
			if (info == null)
				continue;

			if (info.nId == nId)
				return info;
		}

		return null;
	}

	public MeetingExpress getMaxIdMeetingExpress() {

		int nMaxId = 0;

		for (int i = 0; i < listMeetingExpress.size(); i++) {
			MeetingExpress info = listMeetingExpress.get(i);
			if (info == null)
				continue;

			if (info.nId > nMaxId == true)
				nMaxId = info.nId;
		}

		return getMeetingExpress(nMaxId);
	}
}
